updating oE peek_longu
peek_longu
<built-in> function peek_longu(object addr_n_length)
fetches an unsigned integer, or some unsigned integers, from an address in memory.
Parameters:
- addr_n_length : an object, either of
- an atom addr -- to fetch one double word at addr, or
- a pair {addr,len} -- to fetch len double words at addr
Returns:
An object, either an atom if the input was a single address, or a sequence of atoms if a sequence was passed. In both cases, atoms returned are based on the native size of a "long int." On Windows and all other 32-bit architectures, the number will be in the range 0..power(2,32)-1. On other 64-bit architectures, the number will be in the range of 0..power(2,64)-1.
Errors:
Peeking in memory you do not own may be blocked by the OS, and cause a machine exception. If you use the define safe these routines will catch these problems with a Euphoria error.
When supplying a {address, count} sequence, the count must not be negative.
Comments:
Since addresses are 32-bit numbers on 32-bit architectures, they can be larger than the largest value of type integer (31-bits). Variables that hold an address should therefore be declared as atoms.
It is faster to read several integers at once using the second form of peek than it is to read one integer at a time in a loop. The returned sequence has the length you asked for on input.
Remember that peek_longu takes just one argument, which in the second form is actually a 2-element sequence.
The only difference between peek_longs and peek_longu is how double words with the highest bit set are returned. peek4s assumes them to be negative, while peek_longu just assumes them to be large and positive.
Example 1:
-- The following are equivalent (on a 32-bit architecture, or Windows): -- first way s = {peek_longu(100), peek4u(104), peek4u(108), peek4u(112)} -- second way s = peek_longu({100, 4})
See Also:
Using Data Double Words, poke4, peek, peek4s, allocate, free, peek2u, peek2s, peek8u, peek8s, peek_longs, poke_long
Not Categorized, Please Help
|